Example notebook for the Git Information file

DW 2015.10.2015

This is an example Notebook to show how gitInformation works.


In [1]:
# Import the gitInformartion file to your notebook
# It's important that you have installed GitPython (pip install gitpython) and that you have a local Git repository
import sys
sys.path.insert(0, 'C:\Users\Dominik\Documents\GitRep\ipython-notebook-git')
import gitInformation

In [2]:
#If your notebook is located in a git repository, you are now able to plot some informations about the notebook to verify the version.
gitInformation.printInformation()


Information about this notebook
============================================================
Date: 2015-10-27
Python Version: 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)]
Git directory: C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\.git
Current git SHA: ca68a89e6af4c8cfcb04aa903eef325edf3ad7dc
Current remote: origin
Current branch: master

As you can see, the 'printInformation' function collects all information by its own, so you dont need to set any path.


In [3]:
# You're also able to set the path by your own to get the git information
gitInformation.printInformation('C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\example notebook')


Information about C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\example notebook
============================================================
Date: 2015-10-27
Python Version: 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)]
Git directory: C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\.git
Current git SHA: ca68a89e6af4c8cfcb04aa903eef325edf3ad7dc
Current remote: origin
Current branch: master

In [4]:
# It is also possible to print single information like the current branch, Git commit sha, remote and directory
gitInformation.printCurrentBranch()


Current branch: master

In [5]:
gitInformation.printCurrentGitSHA()


Current git SHA: ca68a89e6af4c8cfcb04aa903eef325edf3ad7dc

In [6]:
gitInformation.printCurrentRemote()


Current remote: origin

In [7]:
gitInformation.printGitDirectory()


Git directory: C:\Users\Dominik\Documents\GitRep\ipython-notebook-git\.git